package com.hellogood.yaohuo.server.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.hellogood.yaohuo.server.db.DBHelper;

public class MkDAO extends DBHelper {
	Logger log = Logger.getLogger(this.getClass());

	@Override
	public List<?> initializeObject(ResultSet rs) throws SQLException {
		List<String> list = new ArrayList<String>();
		if (rs != null) {
			while (rs.next()) {
				list.add(rs.getString("MkCode"));
			}
		}
		return list;
	}

	@SuppressWarnings("unchecked")
	public List<String> getMkCodeByUser(String user) {
		String sql = "SELECT mkCode FROM groupqx q,groupuser u WHERE q.groupcode = u.groupcode AND u.staffcode = '" + user + "'";
		List<?> list = super.query(sql);
		return (List<String>) list;
	}
}
